// 定义一个混入对象
export const areaMixin = {
    computed: {
        areaSelectedId() {
            return this.$store.state.areaTreeSelectedId
        },
        isDisabledAdd() {
            return this.$store.getters.isCompany
        },
    },
    mounted() {
        let currSelectedTreeNode = this.$store.state.areaTreeSelectedId || []
        if (currSelectedTreeNode.length) {
            this.selectTreeItem(currSelectedTreeNode)
        }
    },
    watch: {
        areaSelectedId: function (val) {
            if (Array.isArray(val) && val.length > 0) {
                // 在需要使用到mixin的组件中，定义selectTreeItem来实现业务
                this.selectTreeItem(val)
            }
        },
    },
}
